package hgz.stu.review.ruijie.config.resolve;

import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.util.StringUtils;

import hgz.stu.review.ruijie.enviroment.SkyEngineEnvType;

/**
 * Description: Function Description
 * Copyright: Copyright (c) 2017
 * Company: Ruijie Co., Ltd.
 * Create Time: 2018/8/28
 *
 * @author dell
 */
public class RootConfigResolver extends AbstractConfigResolver {

    public RootConfigResolver(ResourcePatternResolver resourceLoader) {
        super(resourceLoader);
    }

    @Override
    public boolean containsConfig() {
        return true;
    }

    @Override
    String buildLocation(SkyEngineEnvType skyEngineEnvType, String moduleName) {
        String modulePath = StringUtils.isEmpty(moduleName) ? "" : "/"+moduleName;
        String location = "classpath:/config/"+modulePath+"/*-"+ skyEngineEnvType.toString().toLowerCase()+".properties";
        return location;
    }

    @Override
    public int getOrder() {
        return 2;
    }
}
